<%@ page contentType="text/html; charset=UTF-8" %> 
<%@page import="net.zhnb.util.*"%>
<%@ page import="net.zhnb.bean.*"%>
<%@page import="java.util.*"%>
<%@page import="finaler.util.*"%>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
<jsp:include page="adminImport.jsp"/>
</head>
<% 
	PageList adList =  (PageList) request.getAttribute("adList"); 
%>

<script>
	function del(id){
		if(confirm("确定吗!")){
			var url =  "<%=Constants.URL%>/admin/adDel_"+id;
			window.location = url;
		}
	}
	function checkForm(){
		if($("#adimg").val()==""){
			alert("请选择图片文件!");
			return false;
		}
	}
</script>

<body>

<a href="<%=Constants.URL %>/admin/menu">返回</a><br/><br/>

<form action="<%=Constants.URL %>/admin/adUpload" id="aform" name="aform" enctype="multipart/form-data" method="post" onsubmit="return checkForm()">
	选择展示广告:<input type="file" id="adimg" name="adimg" size="40"/><input type="submit" value="上传"/>
</form>

<!-- Table goes in the document BODY -->
<table class="hovertable">
	<tr>
	    <th>展示码id</th><th>小预览图</th><th>添加时间</th><th>删除</th><th>模拟访问</th>
	</tr>
	<%
	for( int i=0;i<adList.getList().size();i++){
		Ad ad = (Ad) adList.getList().get(i);
	%>
		<tr align="center" onmouseover="this.style.backgroundColor='#ffffff';" onmouseout="this.style.backgroundColor='#d4e3e5';">
		    <td><%=ad.getId()%></td>
		    <td><img src="<%= Constants.URL%>/upload/ad/<%=ad.getImgpath()%>" width="50" height="50"/></td>
		    <td><%=ad.getDatetime()%></td>
		    <td><a href="###" onclick="del('<%=ad.getId()%>')">删除</a></td>
		    <td><a href="<%= Constants.URL%>/main/ad_<%=ProjectUtil.encodeBase64( Constants.AD_NAME + "_"+ad.getId()+"_" + Constants.AD_NAME)%>" target="_blank">点击访问</a></td>
		</tr>
	<%} %>
		<tr>
		    <td colspan="7">
				<%=PageUtil.getCurrPage(adList)%>
				<%=PageUtil.getRecord(adList)%>
				<%=PageUtil.getSinglePaginator(adList,false)%>
		    </td>
		</tr>
</table>



</body>
</html>